package com.ecp.pay.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.ecp.pay.online.service.WangyinService;

/**
 * * @author shichao;
 * 
 * @date 2015年11月4日 上午10:30:37
 */
@Controller
public class OnlineController {

	private String onlinePay_wangyin = "/front/pay/pay_online/onlinePay";

	@Autowired
	private WangyinService wangyinService;

	@RequestMapping("/flight/onlinePay.do")
	public ModelAndView OnlinePay(HttpServletRequest request, HttpServletResponse response) {
		Map<String, Object> model = new HashMap<String, Object>();
		try {
			model = this.wangyinService.getSendInfo(request);
		} catch (Exception e) {
			e.printStackTrace();
			model.put("error", true);
			model.put("msg", "系统错误,请稍后重试！");
		}
		if (model.containsKey("error")) {
			return new ModelAndView("/json", "json", model.get("msg"));
		}
		return new ModelAndView(onlinePay_wangyin, model);
	}
	
}
